home *** CD-ROM | disk | FTP | other *** search
- //--------------------------------------------------------------------------
- //
- // PACKman
- // by Scott “Zz” Zimmerman & Nick Thompson
- //
- // Description: This snippet shows how to implement a simple
- // Chooser Package, updated from Scott “Zz” Zimmerman's
- // PACKman pascal sample
- //
- // Version: 1.0 Completed 10/19/94
- //
- //
- // Modification History:
- //
- // 10/18/94 nick converted from Pascal
- // 10/19/94 nick updated to reflect info in IM: Devices (pages 1-42 ff)
- // this sample is think C specific
- //
- // To do:
- // implement for metrowerks and MPW C
- //
- // Copyright: © 1989-94 by Apple Computer, Inc., all rights reserved.
- //--------------------------------------------------------------------------
-
- #define VERSION 10 // Version (1.0)
- #define DEVICEID 128 // Device ID
-
- extern pascal OSErr MyPackage( short message, short caller, StringPtr objName, StringPtr objectName, long p1, long p2) ;
-
- // Device package flags
- //
- // we work out the flags by seeting the appropriate bit in the longword.
- // for our extension we want to set the following flags:
- //
- // usesAppleTalk,
- // noPAP,
- // noPostScript,
- // noMultiples,
- // noLeftButton,
- // noRightButton,
- // usesSavedZoneName,
- // noActualZoneNames,
- // acceptsInit,
- // acceptsNewSel,
- // acceptsFillList,
- // acceptsGetSel,
- // acceptsSelect,
- // acceptsDeselect,
- // ignoresTerminate,
- //
- // This equates to the following:
- //
- // 1098 7654 3210 9876 5432 1098 7654 3210 - bit position
- // 1000 0010 0000 0001 1111 0000 0000 0000 - value (see Device package flags, below)
- // 8 2 0 1 F 0 0 0 - this is 0x8201F800
- //
- // the meaning of the flags is as follows:
- //
- // Bit Meaning
- //
- // 31 Set if an AppleTalk device
- // 30–29 Reserved (clear to 0)
- // 28 Set if the device package can have multiple instances selected at once
- // 27 Set if the device package uses the Left button
- // 26 Set if the device package uses the Right button
- // 25 Set if no zone name has been saved
- // 24 Set if the device package uses actual zone names
- // 23–21 Reserved (clear to 0)
- // 20 Set if the device uses the On and Off radio buttons and radio button label
- // 19–17 Reserved (clear to 0)
- // 17 Set if the device package accepts the chooserInitMsg message
- // 16 Set if the device package accepts the newSelMsg message
- // 15 Set if the device package accepts the fillListMsg message
- // 14 Set if the device package accepts the getSelMsg message
- // 13 Set if the device package accepts the selectMsg message
- // 12 Set if the device package accepts the deselectMsg message
- // 11 Set if the device package accepts the terminateMsg message
- // 10–0 Reserved (clear to 0)
-
- main()
- {
- // set up the header for the PACK resource
- asm {
- bra.s @start // branch to label start
- dc.w DEVICEID // declare word const as the pack device ID
- dc.l 'PACK' // the resource type
- dc.w 0xF000 // this is -4096, for the chooser
- dc.l VERSION // the version number of our package
- dc.l 0x8201F800 // Device package flags (see long comment above)
- start:
- jmp MyPackage
- }
- }
-